#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author:    御风
# @Mail:      zhong.yufeng@foxmail.com
# @Time:      2022/4/12 1:30


from flask_cors import cross_origin
from utils.result import ApiResult
from utils.session.session import Session
from .admin import route


# http://127.0.0.1:9001/admin/info
@route.route(r"/info", methods=["GET"], strict_slashes=False)
@cross_origin()
def apiInfo():
    """
    管理登录信息
    """
    session = Session.get()
    adminId = session.get("adminId", None)
    adminAccount = session.get("adminAccount", None)
    result = {
        "id":      adminId,
        "account": adminAccount,
        "session": Session.serializer(),
    }
    return ApiResult.success(result, msg="成功")
